package guilib;

/***
 * @author Ragnvald Fuglestein
 */

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.AbstractCellEditor;
import javax.swing.CellEditor;
import javax.swing.JButton;
import javax.swing.JDialog;

import baseStructure.Log;


public class PlaylistTableCellEditor extends AbstractCellEditor implements CellEditor, ActionListener {
    private static final long serialVersionUID = 8221214880313514816L;

    protected static final String EDIT = "edit";
    protected static final String OK = "ok";
    protected static final String CANCEL = "cancel";
    protected Object object;
	protected JButton button;
    protected JDialog dialog;
    
    /***
     * dialog must be set in subclass
     * @param object
     */
	public PlaylistTableCellEditor(Object object) {
		this.object = object;
	}
	
	@Override public Object getCellEditorValue() {
		return object;
	}
	
	@Override public void actionPerformed(ActionEvent e) {
		if (EDIT.equals(e.getActionCommand())) {
			dialog.setVisible(true);
			fireEditingStopped();
		} else {
			Log.d("act: " + e.getActionCommand());
		}
		
	}

}
